package com.aeye.mbr.upms.client.util;

import com.aeye.mbr.upms.dao.model.UpmsUser;

public class SecurityHelper {


    private static final ThreadLocal<UpmsUser> contextHolder = new ThreadLocal<>();

    public static UpmsUser getCurrentUser(){
        return contextHolder.get();
    }

    public static void setUser(UpmsUser user){
        contextHolder.set(user);
    }



    public static Integer getCurrentTopOrgId(){
        UpmsUser user = getCurrentUser();
        if(user != null){
            return user.getTopOrgId();
        }
        return null;
    }

}
